<?php
/**
 * CJCrop 图片剪切
 * @author yangdongqi <yangdongqi@hayzone.com>
 * @package lib.widgets.jcrop
 */
class CJCrop extends CWidget {
	
	public $target = '';
	public $options = '';
	
	public static $count = 0;
	
	public function run() {
		
		$cs = Yii::app()->clientScript;
		$am = Yii::app()->assetManager;
		$url = $am->publish(dirname(__FILE__).'/assets');
		
		$cs->registerScriptFile($url.'/jquery.Jcrop.min.js');
		$cs->registerCssFile($url.'/css/jquery.Jcrop.css');
		
		$script = <<<EOD
jQuery('{$this->target}').Jcrop({$this->options});
EOD;

		$cs->registerScript('jcrop_'.(++self::$count), $script);
		
	}
	
}



?>